package edu.nf.project.mappers.employeeAndCustomerInformation.convention;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.nf.project.entitys.dto.employeeAndCustomerInformation.CustomerDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author CSY
 * @date 2025 - 06 - 11
 */
@Mapper
public interface CustomerDTOMapper extends BaseMapper<CustomerDTO> {
    @Select("select u_name uName,phone,pwd,created_at createAt,\n" +
            "customer_id customerId,customer_fullname customerFullName,\n" +
            "member_code memberCode,point,surplus,total_amount totalAmount,\n" +
            "m.member_id memberId,member_name memberName\n" +
            ",need_amount needAmount,gift_point giftPoint\n" +
            " from users u join customer_info ci on u.u_id = ci.u_id\n" +
            "join member m on ci.member_id = m.member_id where u.u_id = #{uId}")
    CustomerDTO getCustomerByUserId(@Param("uId") Integer uId);
}
